In graphics image processing systems, application of texture maps to the surfaces of graphics primitives are used to create the appearance of texture on a rendered graphics image. Texture maps are typically graphics images composed of “texels” that are arranged in a rectangular coordinate system. Thus, a texture map has an associated width and height. In applying the texture map to the surface of a graphics primitive, the texel coordinates of texels that are needed to calculate the color value of a pixel in a rendered graphics image are identified, and the color data associated with the identified texels are retrieved from memory. The color value of the pixel is then calculated from the retrieved color values using one of various well-known techniques. Consequently, when a texture map is applied to the surface, the surface adopts the characteristics of the texture, such that the coloring for the surface is derived from the texture. The applied texture map results in a realistic texture appearance in the rendered graphics image.
When calculating the texel coordinates for the texels that should be retrieved to calculate the color value of the pixel in the graphics image, the calculated texel coordinates may fall outside of the coordinate range of the texture map. Several different texture addressing modes have been developed to deal with this situation. For example, a “repeat” addressing mode causes a texture to be repeated as it is applied onto a graphics primitive. A “mirror” addressing mode causes a texture to be repeated such that every other repetition is a mirrored version of the original texture. The previous two addressing modes have the advantage of allowing a relatively small texture map to be applied repetitively to cover a larger surface of a graphics image. Consequently, less data needs to be stored in memory for the application of a texture over a large surface.
Additional addressing modes include a “clamp-to-edge” addressing mode that fixes the texel coordinate to that of the texel at the edge of the texture map when the calculated texel address is beyond the range of the texture map. Thus, the color value of the edge texel is used as the color value for the pixel. A “clamp-to-border” addressing mode fixes the texel coordinate to one texel beyond the border of the texture map. A border color is assigned to the texels beyond the edge of the texture map, resulting in a pixel having a color value of the border color. Another addressing mode is the “clamp-to-half-edge and half-border” addressing mode, where the texel address is clamped to one-half a texel beyond the edge of the texture map, yielding a color value for the pixel that is the combination of the color value of the edge texel and a border color.
Application of the various addressing modes is a relatively simple operation where a texture map has a width and height that are powers of two. In this case, application of masks based on logical AND gates are typically used to generate appropriate texel coordinates from the input coordinate values when requesting graphics data for a texel located outside the range of the texture map. However, where the texture map does not have dimensions that are a power of two, that is to say the texture map has an arbitrary size, several comparators and additional selection circuitry are required to carry out the various addressing modes. The additional circuitry adds complexity to the overall graphics processing system and consumes additional space where the graphics processing system is integrated into a single device.
Exacerbating the problem is the fact that during texture processing, addressing mode operations may need to be performed in combination with the application of one or more advanced graphics algorithms, such as bump mapping, anisotropic filtering, and mipmapping. Consequently, the problems associated with circuit complexity and size are compounded where several graphics algorithms are performed during texture processing. As a result, the complexity and size of the overall graphics processing system may dramatically increase in order to accommodate various addressing modes for arbitrary sized texture maps.